package org.dtrd.modules.doctor.entity.bean;

import cn.hutool.core.date.DateUtil;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.common.util.DateUtils;
import org.dtrd.config.system.Constant;
import org.dtrd.modules.patient.entity.po.DtrdEntRdPatient;

/**
 * @author qr
 * @date 2021/12/17 10:12
 */
@ApiModel("医生所属患者列表显示的信息")
@Getter
@Setter
public class DoctorPatientInfo {

    @ApiModelProperty("患者id")
    private Integer patientId;

    @ApiModelProperty("姓名")
    private String name;

    @ApiModelProperty("患者头像")
    private String avatar;

    @ApiModelProperty("性别")
    private Integer sex;

    @ApiModelProperty("年龄")
    private Integer age;

    @ApiModelProperty("糖尿病类型")
    private String diabetesType;

    @ApiModelProperty("确诊时间")
    private String confirmTime;

    @ApiModelProperty("症状")
    private String symptoms;

    @ApiModelProperty("起始时间")
    private String startTime;

    public DoctorPatientInfo(DtrdEntRdPatient po) {
        patientId = po.getDataId();
        name = po.getPatientsName();
        sex = po.getPatientsSex();
        if (po.getPatientsBirthday() != null) {
            age = DateUtil.ageOfNow(po.getPatientsBirthday());
        }
        if (po.getPatientsDiabetisType() != null) {
            diabetesType = Constant.DiabetesType.valueOf(po.getPatientsDiabetisType()).getName();
        }
        if (po.getPatientsConfirmedDate() != null) {
            confirmTime = DateUtils.formatDate(po.getPatientsConfirmedDate(), DateUtils.yyyyMMdd_slash.get().toPattern());
        }
        avatar = po.getPatientsImg();
        symptoms = po.getPatientsDescription();
    }
}
